<extend name="Public/base"/>
<block name="body">
  <!-- 标题栏 -->
  
  <div class="main-title">
    <h2>订单列表</h2>
  </div>
  <div class="tools"> <a class="btn" href="javascript:history.back(-1);">返 回</a> 
    
    <!-- 高级搜索 -->
    <div class="search-form fr cf">
      <div class="sleft">
        <div class="drop-down"> <span id="sch-sort-txt" class="sort-txt" data="{$status}">
          <if condition="get_status_order($status) eq ''">所有
            <else/>
            {:get_status_order($status)}</if>
          </span> <i class="arrow arrow-down"></i>
          <ul id="sub-sch-menu" class="nav-list hidden">
            <li><a href="javascript:;" value="">所有</a></li>
            <li><a href="javascript:;" value="1">待审核</a></li>
            <li><a href="javascript:;" value="2">待发货</a></li>
            <li><a href="javascript:;" value="3">已发货</a></li>
            <li><a href="javascript:;" value="4">已收货</a></li>
            <li><a href="javascript:;" value="5">已退货</a></li>
          </ul>
        </div>
        <input type="text" name="title" class="search-input" value="{:I('title')}" placeholder="请输入姓名和手机号">
        <a class="sch-btn" href="javascript:;" id="search" url="{:U('Order/index')}"><i class="btn-search"></i></a> </div>
      <div class="btn-group-click adv-sch-pannel fl">
        <button class="btn">高 级<i class="btn-arrowdown"></i></button>
        <div class="dropdown cf">
          <div class="row">
            <label>订单时间：</label>
            <input type="text" id="time-start" name="time-start" class="text input-2x" value="" placeholder="起始时间" />
            -
            <input type="text" id="time-end" name="time-end" class="text input-2x" value="" placeholder="结束时间" />
          </div>
        </div>
      </div>
    </div>
  </div>
  
  <!-- 数据列表 -->
  <div class="data-table category">
    <div class="data-table table-stripe">
      <table class="">
        <thead>
          <tr>
            <th class="">订单号</th>
            <th class="">业务员姓名</th>
            <th class="">商品</th>
            <th class="">总金额</th>
            <th class="">客户信息</th>
            <th class="">订单时间</th>
            <th class="">描述</th>
            <th class="">状态</th>
            <th class="">操作</th>
          </tr>
        </thead>
        <tbody class="">
            <notempty name="_list">
          
          <volist name="_list" id="vo">
            <tr id="{$vo.id}">
              <td>{$vo.ordid} </td>
              <td>{$vo.username} </td>
              <td><ul>
                  <volist name="vo.son" id="vo2">
                    <li>{$vo2.good_title} <span style="color:#999">×{$vo2.ordbuynum}</span></li>
                  </volist>
                </ul></td>
              <td>{$vo.ordfee}</td>
              <td>{$vo.name},{$vo.cmobile}</td>
              <td>{$vo.ordtime|date="Y-m-d H:i",###}</td>
              <td>{$vo.mssegs}</td>
              <td>{$vo['ordstatus']|get_status_order}</td>
              <td><eq name="vo.ordstatus" value="1"> <a class="confirm ajax-get" href="{:U('Order/setStatusOrder', 'status=2&ids='.$vo['id'])}">审核</a> <a class="confirm ajax-get" href="{:U('Order/setStatusOrder', 'status=6&ids='.$vo['id'])}">取消</a> </eq>
                <eq name="vo.ordstatus" value="2"> <a class="confirm" href="{:U('Order/Sipping', 'id='.$vo['id'])}">发货</a> </eq>
                <eq name="vo.ordstatus" value="3"> <a class="confirm ajax-get" href="{:U('Order/setStatusOrder', 'status=4&ids='.$vo['id'])}">收货</a> </eq>
                <eq name="vo.ordstatus" value="4"> <a class="confirm ajax-get" href="{:U('Order/setStatusOrder', 'status=4&ids='.$vo['id'])}">收货</a>
                <a class="confirm ajax-get" href="{:U('Order/refund', 'id='.$vo['id'])}">退货</a> </eq></td>
            </tr>
          </volist>
          <else/>
        <td colspan="8" class="text-center"> aOh! 暂时还没有内容! </td>
            </notempty>
            </tbody>
      </table>
    </div>
  </div>
  <div class="page"> {$_page} </div>
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>
if(C('COLOR_STYLE')=='blue_color') echo '
<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">
';
</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script> 
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script> 
<script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script> 
<script type="text/javascript">

		
  //搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
		var status = $("#sch-sort-txt").attr("data");
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
		if(status != ''){
			query = 'status=' + status + "&" + query;
        }
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});
	/* 状态搜索子菜单 */
	$(".search-form").find(".drop-down").hover(function(){
		$("#sub-sch-menu").removeClass("hidden");
	},function(){
		$("#sub-sch-menu").addClass("hidden");
	});
	$("#sub-sch-menu li").find("a").each(function(){
		$(this).click(function(){
			var text = $(this).text();
			$("#sch-sort-txt").text(text).attr("data",$(this).attr("value"));
			$("#sub-sch-menu").addClass("hidden");
		})
	});

 //回车自动提交
    $('.search-form').find('input').keyup(function(event){
        if(event.keyCode===13){
            $("#search").click();
        }
    });
	  $('#time-start').datetimepicker({
        format: 'yyyy-mm-dd',
        language:"zh-CN",
	    minView:2,
	    autoclose:true
    });

    $('#time-end').datetimepicker({
        format: 'yyyy-mm-dd',
        language:"zh-CN",
	    minView:2,
	    autoclose:true
    });
    //导航高亮
    highlight_subnav('{:U('Order/index')}');
</script>
</block>
